package com.hzdl.web.service;

import com.hzdl.web.bean.User;
import com.hzdl.web.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Sfx
 * Date: 2018/9/2 0002
 * Time: 下午 9:01
 * To change this template use File | Settings | File Templates.
 */
@Service
public class UserService {
    @Autowired
    private UserDao userDao;
    public User login(String account,String password){
        User user = userDao.getUserByAccountAndPassword(account,password);
        userDao.updateLoginTime(user);
        return user;
    }

    public void addUser(User user){
        userDao.addUser(user);
    }
    public List<User> getAll(){
        return userDao.getUsers();
    }
}
